"""
爬取书旗小说网中的小说
分析 ：
    1、直接搜搜不到
    响应数据被加密或编码不是明文内容

    2、刷新'下一页' 第一个出现的并且响应为200的就是我们要找的
    其中请求地址url为：
    https://c13.shuqireader.com/pcapi/chapter/contentfree/?bookId=8884348&chapterId=2061781&ut=1710985104&num=1&ver=1&aut=1736750357&sign=78cb7abfc45bbdc81825fa4ba0f70936
    参数有很多  弄两个页面的做对比推出那些参数是固定的那些是需要‘想办法的’
        bookId: 8884348
        chapterId: 2061781
        ut: 1710985104
        num: 1
        ver: 1
        aut: 1736750357
        sign: 78cb7abfc45bbdc81825fa4ba0f70936

    看其他页参数
        bookId: 8884348
        chapterId: 2061780
        ut: 1710984882  #未知
        num: 1
        ver: 1
        aut: 1736750357
        sign: 3fe7bcf94016c0c7cc330b4fa7cb3920  #未知

    返回对象为：
    {
    "state": "200",
    "message": "success",
    "ChapterContent": "44PN44PNVPQaaVUya47iiVmcd5wbtVCzwVszwXKxhX3yi4CwtVV8LaViChBNtBBNtPNt5YvN5Yvd6VPO5nF05M2D5Mlb6LXw6LrZ77lZ55l856Jr6LrZ6M2v5ovz552N5YvA5bXz77ln4bPp5Y2t5Yhf6nhL6VPQ5blU5bly6LBb5L6W5n6m5MJX77lZ6Y+r5bvE6LB96XnO6Yrs552N5YvN6YJ356nO6Mrg77lO55ls5cvi5YvA5Lvj5clN5MPB5YvN5Lv755ls55dR6XnO5Y+q5blO5MXZ5nFJ55JZ55dR6MdH57hq5MJX77lO4bPqCTWlYm7wtVQwtVNtVBnKtrv+hrJUbBF4dhnIzrvPfhzQdBrnuBzvuhJiiBJSdBzQdBzQirv1yBrfxr+8zhXNaBv/zrnLe+vauBJVzrJLz++8wBvauBJVzrXNchXNchXNaGkvpv8+44PN44PNVPQycbYzacmzaVaxheebt73yaXwbi5acu4maaViyvYQazbGbe53iiVmah53ye7axiWezy6Qze5GazbGbe6syiVYwtVV8LaViChBNtBBNtPNt5Mlb5crO6Y6557hM6Y+M6VPO5nF06LPF6Vl255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GxheexhVQateact73zfdUzaVaczYizenYazbGzbYsyeMQiiVmbcbUaa6KctMCbi5ayw6/zzX/cd5wbtVCazbGyu7ecbcwxheexhLixhVQiiVmycbYzacmzzX/yuooxh5oazbGyu7ecbcwxheeiiVmaweQyaXwyw6/ct73zzX/yaXwzfdUzaVactWebed/bee7ycVsazbGyaYQzyeaiiVR8LaViChBNtBBNtPNt6nhL6VPQ5YvA57hG5c2s77lZ5YhJ5Yhf5oPk5YvA6VB95Lr65c2y77lOCTWlYm7wtVQwtVNtVBvNwBv/zrvNtrJxgB+8wBvQirznw+nRw+rnuBF9i+rHdBrHgrJgxBvhihJxu++8wBJCdhzptBvztrF6hhJpdBv/zrzUwBJjfrJCe+F7crF6uhBNtwkvpv8+44PN44PNVPQvtWmbi5actMCcbcwaeMGazbGxheeyhcGbe6KxiWexhV3yfWUiiVmxiLoycbYzacmxhV3ayYibee7bedUyz77azbGiiVmct73zzX/ytLsazbGiiVmzaVQycWeah5axhXexhVQxhXGyvVowtVYvtW3yiXQywniyz73zyoYyu7iaaLQcyX7az5wiiVmxhVQbieabe7GctMCwtVV8LaViChBNtBBNtPNt4bPp5bz55cF555dR5cr25LPM77lZ57hq5n+55YvA6VB957hM6LXw5Ydo5er35LvT55dR5Yd66M2v5n2D44PP4bPqCTWlYm7wtVQwtVNtVBnqdBvPfhnWwrv/ahJ/zrrPhrJxgB+8zhXNaBJ8bBvNtrnHihJ/t++8trXNaGkvpv8+44PN44PNVPQvtXovtXL8LaViChBNtBBNtPNt4bPp6VFE5n2D5clW54X55enb4bPz4bPz4bPqCTWlYm7wtVQwtVNtVBXNaBF9uhrBfBJpdBJTzrJUhhnqcr+8wBnRa+vavrJjfrJyirJxzhF6uhBNthXNarvYw+JYcBF4tBv+hrJTzrrqtB+8wBF4tBv+hrv/zBJpdBrHh+rqtBJoihBNtwkvpv8+44PN44PNVPQxh5oxhM/xhV3aa6KctMCztV7xhLwadbUauYoyfYUyucYyu7ezanKxhbobi5axhLwycWeazbGa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+8wBzQirnpvrrgyBnuvB+8trniw+F4tBzOx+Jxc+zvzB+8wBzQirJTzrF4vhF6uhJ/urvztrrnuBvab+zvzBngcrzdcB+8tGkvpv8+44PN44PNVPQxhM/zaVaaeMGzbLwiiVmbtVmxhWGywLUyvVoazbGaebQzgVUiiVmzfdUzaVaycWexiMaazbGzenKcddGiiVR8LaViChBNtBBNtPNt5oPk5nJ95LBC5cvi4bPz4bPzCTWlYm7wtVQwtVNtVBntu+JUuhrgyBnuvBF4tBntg++8tGkvpv8+"
    }
    就看知道ChapterContent中的内容一个就是我们要的但是被编码了  我们需要对其进行解码或js改写

    请求方式：
    GET

    3、尝试直接搜素参数
        发现每个参数的结果都有很多 因此放弃

    ***从现有的资源找突破口***
    4、搜索域名后的接口地址/chapter/contentfree/  果然藏东西了
        参数都藏里面了
        bookId=8884348&amp;
        chapterId=2061670&amp;
        ut=1718354829&amp;
        ver=1&amp;
        aut=1736750357&amp;
        sign=c9ead22410589204640a1ed59ee63903&amp;

    请求地址：
        https://www.shuqi.com/reader?bid=8884348&cid=2061781

    我们需要的界面能够通过上面的分析找到最后就是将ChapterContent中的内容解码出来
    5、搜索ChapterContent 找到js源码 见名知意 decodeCont解码
    a = i._decodeCont(t.ChapterContent) || ""
    在源文件中打开  并且找到js源码做修改
    先设置断点 一步一步运行看是不是这个js方法
    在源码中找到对应的js方法
    将js局部方法挂载到window中成为全局方法
    最后就用 playwright 对js方法拦截并替换

结论：
    1、找https://c13.shuqireader.com/pcapi/chapter/contentfree/?后面的参数
        请求地址：
            https://www.shuqi.com/reader?bid=8884348&cid=2061781
                bid为bookId            cid为chapterId
    2、找到参数后带参数直接请求得到待解析的decodeCont内容
    3、找到js源码链接地址 并且改写保存到本地
    4、用 playwright 偷换js为本地的js得到解析后的数据
    5、保存数据

"""
import json
import re
from playwright.sync_api import sync_playwright

import subprocess
from functools import partial

subprocess.Popen = partial(subprocess.Popen, encoding='utf-8')  #在导入execjs前加入补丁 解决js编码字符集问题
import execjs


from xunter_utils.xunter_requests import ChromeClient


class Shuqireader(ChromeClient):
    def __init__(self):
        super().__init__()
        self.host = 'https://www.shuqi.com/'
        self.data = []

        context = sync_playwright().start()  # 开始执行playwright
        browser = context.chromium.launch(headless=False)  # 创建有头谷歌浏览器
        self.page = browser.new_page()  # 创建一个页面

        self.page.route(
            'https://www.shuqi.com/js/reader.js?v=2024.11.01.1',
            lambda route: route.fulfill(path=r'./ChromeOverrides/www.shuqi.com/js/reader.js%3Fv=2024.11.01.1')
        )  # 把网络请求中js替换成本地修改好的js文件

    def get_page(self, bid):
        """
        得到书籍首页(目录)
        :param bid:书籍id
        :return:
        """
        res = self.send_request(self.host + 'book/' + bid + '.html')
        # print(res.status_code)
        return res

    def get_chapter(self, res):
        """
        在书籍首页得到章节地址
        :param res:
        :return:
        """
        chapter_id = re.findall(r'cid=(\d+)', res.text)
        return chapter_id
        # print(chapter_id)

    def get_param(self, bid: str, cid):
        """
        :param bid: 书籍id
        :param cid: 章节id
        :return:
        """
        # https: // www.shuqi.com / reader?bid = 8884348 & cid = 2061781
        # print(cids)
        # print(type(cids))
        print(self.host + f'reader?bid={bid}&cid={cid[0]}')
        res = self.send_request(self.host + f'reader?bid={bid}&cid={cid[0]}')
        # print(res.text)
        params = re.findall(
            r'bookId=(\d+)&amp;chapterId=(\d+)&amp;ut=(\d+)&amp;num=(\d+)&amp;ver=(\d+)&amp;aut=(\d+)&amp;sign=([a-f0-9]+)',
            res.text)
        for param in params:
            self.data.append(param)
            # print(self.data)
            # print({
            #     "bookId": param[0],
            #     "chapterId": param[1],
            #     "ut": param[2],
            #     "num": param[3],
            #     "ver": param[4],
            #     "aut": param[5],
            #     "sign": param[6],
            # })
        # for data in self.data:
        #     print(data)

    def get_content(self, data):
        res = self.send_request(
            f'https://c13.shuqireader.com/pcapi/chapter/contentfree/?bookId={data[0]}&chapterId={data[1]}&ut={data[2]}&num={data[3]}&ver={data[4]}&aut={data[5]}&sign={data[6]}')
        # print(f'https://c13.shuqireader.com/pcapi/chapter/contentfree/?bookId={data[0]}&chapterId={data[1]}&ut={data[2]}&num={data[3]}&ver={data[4]}&aut={data[5]}&sign={data[6]}')
        parsed_data = json.loads(res.text)
        # print(parsed_data.get('ChapterContent'))

        return parsed_data.get('ChapterContent')

    def decode_content1(self, content, bid, cid):
        self.page.goto(f'https://www.shuqi.com/reader?bid={bid}&cid={cid}')
        self.page.wait_for_load_state("load")
        res = self.page.evaluate(
            """
            ()=>{
            return window.decodeCont('%s')
            }
            """ % content
        )
        res = res.replace('<br/>', '\n')
        return res

    def decode_content2(self, content, ):
        self.page.wait_for_load_state("load")
        #将对象改成方法
        js_data = """
                 function decodeCont(t) {
            return t = function(t) {
                return t.split("").map(function(t) {
                    var e, i;
                    return t.match(/[A-Za-z]/) ? (e = Math.floor(t.charCodeAt(0) / 97),
                    i = (t.toLowerCase().charCodeAt(0) - 83) % 26 || 26,
                    String.fromCharCode(i + (0 == e ? 64 : 96))) : t
                }).join("")
            }(t),
            function(t) {
                var e, i, a, n, r, c, o, s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", d = "", l = 0;
                for (t = t.replace(/[^A-Za-z0-9\+\/\=]/g, ""); l < t.length; )
                    n = s.indexOf(t.charAt(l++)),
                    r = s.indexOf(t.charAt(l++)),
                    c = s.indexOf(t.charAt(l++)),
                    o = s.indexOf(t.charAt(l++)),
                    e = n << 2 | r >> 4,
                    i = (15 & r) << 4 | c >> 2,
                    a = (3 & c) << 6 | o,
                    d += String.fromCharCode(e),
                    64 != c && (d += String.fromCharCode(i)),
                    64 != o && (d += String.fromCharCode(a));
                return function(t) {
                    for (var e, i = "", a = 0, n = 0, r = 0; a < t.length; )
                        n = t.charCodeAt(a),
                        n < 128 ? (i += String.fromCharCode(n),
                        a++) : n > 191 && n < 224 ? (r = t.charCodeAt(a + 1),
                        i += String.fromCharCode((31 & n) << 6 | 63 & r),
                        a += 2) : (r = t.charCodeAt(a + 1),
                        e = t.charCodeAt(a + 2),
                        i += String.fromCharCode((15 & n) << 12 | (63 & r) << 6 | 63 & e),
                        a += 3);
                    return i
                }(d)
            }(t)
        }
        """
        js = execjs.compile(js_data)
        res = js.call('decodeCont', content)
        return res.replace('<br/>', '\n')


if __name__ == '__main__':
    client = Shuqireader()
    response = client.get_page('8884348')
    cids = client.get_chapter(response)
    client.get_param('8884348', cids[:1])
    i = 1
    for data in client.data:
        content = client.get_content(data)
        print(i)
        i += 1
        # print(client.decode_content1(content, '8884348', cids[:1]))
        print(client.decode_content2(content))
